<script setup lang="ts">
import '@/assets/styles/main.css'
import { ref, onMounted } from 'vue'
import { useAuthStore } from '@/stores'

const authStore = useAuthStore()
const isReady = ref(false)

// 初始化应用时恢复token
onMounted(() => {
  // 只恢复 token，不主动获取用户信息
  // 用户信息的获取交给路由守卫处理
  authStore.restoreToken()
  isReady.value = true
})
</script>

<template>
  <router-view v-if="isReady" />
  <div v-else class="min-h-screen flex items-center justify-center">
    <a-spin dot />
  </div>
</template>
